<?php
class Spot extends CI_Model {

	
	function __construct()
	{
	// Call the Model constructor
		parent::__construct();
		
	}
	function get_spot($id)
	{
		$this->db->select('name, directions, rating, description, location');
		//$this->db->select('name');
		$query = $this->db->get('spots');
		$this->db->where('id', $id);
		$query = $this->db->get('spots');
		return $query;
	}
	
	
	function insert_spot($form_data)//insert spot into DB. created with form
	{// please read the below note
		$this->db->insert('spots', $form_data);
		
		if ($this->db->affected_rows() == '1')
		{
			return TRUE;
		}
		
		return FALSE;
	}

	function list_spots($loc)//hardcoded to westside for now
	{
		$this->db->select('id');
		$query = $this->db->get('spots');
		$this->db->select('name');
		$query = $this->db->get('spots');
		$this->db->where('location', $loc);
		$query = $this->db->get('spots');
		return $query;
	}
}
?>